using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Easy.Authorization.Models.Mapping
{
    public class Aut_RoleNavigateMapsMap : EntityTypeConfiguration<Aut_RoleNavigateMaps>
    {
        public Aut_RoleNavigateMapsMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            // Table & Column Mappings
            this.ToTable("Aut_RoleNavigateMaps");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.RoleId).HasColumnName("RoleId");
            this.Property(t => t.NavigationId).HasColumnName("NavigationId");
            this.Property(t => t.AllowNavigate).HasColumnName("AllowNavigate");

            // Relationships
            this.HasRequired(t => t.Aut_Navigations)
                .WithMany(t => t.Aut_RoleNavigateMaps)
                .HasForeignKey(d => d.NavigationId);
            this.HasRequired(t => t.Aut_Roles)
                .WithMany(t => t.Aut_RoleNavigateMaps)
                .HasForeignKey(d => d.RoleId);

        }
    }
}
